package org.gd.hellojaxb.example.date;

import org.gd.hellojaxb.adapters.DateAdaptersFactory;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.util.Date;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "foo")
public final class Foo {

    @XmlElement(name = "date", required = true)
    @XmlJavaTypeAdapter(DateAdaptersFactory.Timestamp.class)
    private Date timestamp = null;

    public Foo() {
        timestamp = new Date();
    }

    public Date getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(final Date timestamp) {
        this.timestamp = timestamp;
    }

}
